package com.spyx.controller;


import com.atyx.spyx.model.search.SkuEs;
import com.atyx.spyx.vo.search.SkuEsQueryVo;
import com.spyx.result.Result;
import com.spyx.service.ProductSearchService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/search/product")
@Api(tags = "上架或下架-es")
public class ProductSeacherController {
    @Autowired
    private ProductSearchService productSearchService;

    //小程序端-查询热销好货
    @GetMapping("inner/findHotSkuList")
    @ApiOperation("查询热销好货")
    public List<SkuEs> getHotSkuInfoList(){
        return productSearchService.getHotSkuList();
    }


    //定义两个方法
    @GetMapping("/upper/{skuid}")
    @ApiOperation("上架")
    public Result up(@PathVariable("skuid")Long skuid){
        productSearchService.uppersku(skuid);
        return Result.ok();
    }

    @GetMapping("/down/{skuid}")
    @ApiOperation("下架")
    public Result down(@PathVariable("skuid")Long skuid){
        productSearchService.downsku(skuid);
        return Result.ok();
    }



}
